<%@page import="com.codejob.portal.entity.algorithm.Problem"%>
<%@page import="java.util.ArrayList"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML>
<HEAD>
<TITLE>codejob算法导航</TITLE>
<jsp:include page="/common/meta.jsp"></jsp:include>
<jsp:include page="/common/css_js.jsp"></jsp:include>
<%@ include file="/common/taglib.jsp" %>
<link href="<%=contextPath%>/css/style.css" rel="stylesheet" type="text/css">
<script language="JavaScript" src="<%=contextPath%>/js/jsframework.js"></script>
</HEAD>
<STYLE type=text/css>* {
	PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px
}
BODY {
	FONT: 14px/25px Verdana,Helvetica,Arial,sans-serif; BACKGROUND: #f6f9fd; OVERFLOW: hidden
}
.clear {
	CLEAR: both
}
#header {
	WIDTH: 100%; BACKGROUND: #e7ecf5
}
#table_user {
	COLOR: #294b8c; FONT-SIZE: 12px
}
#table_name {
	TEXT-ALIGN: center; PADDING-BOTTOM: 0px; LINE-HEIGHT: 20px; MARGIN: 0px; PADDING-LEFT: 0px; WIDTH: 100%; LETTER-SPACING: 1px; PADDING-RIGHT: 0px; BACKGROUND: #6386c8; COLOR: #fff; FONT-SIZE: 12px; PADDING-TOP: 0px
}
#header H4 {
	FONT-SIZE: 12px
}
#table_user TR TD IMG {
	BORDER-BOTTOM: #c5d2ed 3px solid; BORDER-LEFT: #c5d2ed 3px solid; PADDING-BOTTOM: 2px; PADDING-LEFT: 2px; PADDING-RIGHT: 2px; BACKGROUND: #fff; BORDER-TOP: #c5d2ed 3px solid; BORDER-RIGHT: #c5d2ed 3px solid; PADDING-TOP: 2px
}
#table_user TR TD.righttext {
	BORDER-BOTTOM: #f00 0px solid; BORDER-LEFT: #f00 0px solid; PADDING-BOTTOM: 6px; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; BORDER-TOP: #f00 0px solid; BORDER-RIGHT: #f00 0px solid; PADDING-TOP: 6px
}
.shortcut:link {
	PADDING-BOTTOM: 3px; PADDING-LEFT: 3px; PADDING-RIGHT: 3px; COLOR: #294b8c; TEXT-DECORATION: none; PADDING-TOP: 3px
}
.shortcut:visited {
	PADDING-BOTTOM: 3px; PADDING-LEFT: 3px; PADDING-RIGHT: 3px; COLOR: #294b8c; TEXT-DECORATION: none; PADDING-TOP: 3px
}
.shortcut:hover {
	PADDING-BOTTOM: 3px; PADDING-LEFT: 3px; PADDING-RIGHT: 3px; BACKGROUND: #7f9cd2; COLOR: #fff; TEXT-DECORATION: none; PADDING-TOP: 3px
}
.shortcut1:link {
	PADDING-BOTTOM: 3px; PADDING-LEFT: 3px; PADDING-RIGHT: 3px; COLOR: #fff; TEXT-DECORATION: none; PADDING-TOP: 3px
}
.shortcut1:visited {
	PADDING-BOTTOM: 3px; PADDING-LEFT: 3px; PADDING-RIGHT: 3px; COLOR: #fff; TEXT-DECORATION: none; PADDING-TOP: 3px
}
.shortcut1:hover {
	PADDING-BOTTOM: 3px; PADDING-LEFT: 3px; PADDING-RIGHT: 3px; BACKGROUND: #999; COLOR: #fff; TEXT-DECORATION: none; PADDING-TOP: 3px
}
.number_hide {
	DISPLAY: none
}
.number_red {
	COLOR: #f00
}
.number_black {
	COLOR: #000
}
#div_content {
	WIDTH: 100%; HEIGHT: 100%
}
#footer {
	LINE-HEIGHT: 24px; WIDTH: 100%; HEIGHT: 100%; FONT-SIZE: 12px
}
#footer UL {
	WHITE-SPACE: nowrap; FLOAT: left
}
#footer UL LI {
	LIST-STYLE-TYPE: none; BACKGROUND: #e7ecf5; FLOAT: left
}
#footer UL LI A:link {
	BORDER-BOTTOM: #6386c8 1px solid; BORDER-LEFT: #6386c8 1px solid; PADDING-BOTTOM: 0px; PADDING-LEFT: 10px; PADDING-RIGHT: 10px; DISPLAY: block; COLOR: #294b8c; BORDER-TOP: #6386c8 1px solid; BORDER-RIGHT: medium none; TEXT-DECORATION: none; PADDING-TOP: 0px
}
#footer UL .sideright {
	BACKGROUND: #e7ecf5; BORDER-RIGHT: #6386c8 1px solid
}
#footer UL LI A:visited {
	BORDER-BOTTOM: #6386c8 1px solid; BORDER-LEFT: #6386c8 1px solid; PADDING-BOTTOM: 0px; PADDING-LEFT: 10px; PADDING-RIGHT: 10px; DISPLAY: block; COLOR: #294b8c; BORDER-TOP: #6386c8 1px solid; BORDER-RIGHT: medium none; TEXT-DECORATION: none; PADDING-TOP: 0px
}
#footer UL LI A:hover {
	PADDING-BOTTOM: 0px; PADDING-LEFT: 10px; PADDING-RIGHT: 10px; DISPLAY: block; BACKGROUND: #fff; COLOR: #294b8c; TEXT-DECORATION: none; PADDING-TOP: 0px
}
#footer UL .here A:link {
	BORDER-BOTTOM: medium none; MARGIN-TOP: 0px; DISPLAY: block; BACKGROUND: #f6f9fd; COLOR: #6386c8; PADDING-TOP: 1px
}
#footer UL .here A:visited {
	BORDER-BOTTOM: medium none; MARGIN-TOP: 0px; DISPLAY: block; BACKGROUND: #f6f9fd; COLOR: #6386c8; PADDING-TOP: 1px
}
</STYLE>
<BODY >
<TABLE style="WIDTH: 100%; HEIGHT: 100%" cellSpacing=0 cellPadding=0>
  <TBODY>
  <TR style="WIDTH: 100%; HEIGHT: 35px">
    <TD>
      <DIV id=header>
      <TABLE id=table_name>
        <TBODY>
        <TR>
          <TD></TD>
          <TD style="TEXT-ALIGN: left; WIDTH: 61px; DISPLAY: none" 
          id=td_logonout><A class=shortcut1 
            onclick="td_logonout_click(this); return false" 
            href="http://passport.csdn.net/logonout.aspx">注销</A></TD></TR></TBODY></TABLE>
      <TABLE style="WIDTH: 100%" id=table_user>
        <TBODY>
        <TR>
          <TD class=profile rowSpan=3><A href="http://hi.csdn.net/my.html" 
            target=_blank><IMG style="WIDTH: 70px; HEIGHT: 70px" id=img_picture 
            alt=头像 src="<%=contextPath%>/images/algothrim/2_guest.gif"></A> </TD>
          <TD class=righttext><A style="DISPLAY: none" id=a_helpCenter 
            class=shortcut onclick=LogClickCount(this,56); 
            href="http://community.csdn.net/Help/HelpCenter.htm" 
            target=_blank>【新手帮助】</A><A id=a_postTopic class=shortcut title=我要提问 
            onclick=LogClickCount(this,49); 
            href="http://forum.csdn.net/PointForum/Forum/PostTopic.aspx" 
            target=_blank>【提问】</A> 
         </TD></TR>
        <TR>
          <TD class=righttext>
			<A style="DISPLAY: none" id=a_login class=shortcut 
            onclick=LogClickCount(this,58); 
            href="http://passport.csdn.net/account/login?from=http://community.csdn.net/" 
            target=_top>【登录】</A> <A style="DISPLAY: none" id=a_register 
            class=shortcut onclick=LogClickCount(this,59); 
            href="http://passport.csdn.net/CSDNUserRegister.aspx" 
            target=_blank>【注册】</A> </TD></TR></TBODY></TABLE></DIV></TD></TR>
  <TR style="WIDTH: 100%">
    <TD>
 <SCRIPT LANGUAGE="JavaScript">
        var data={};
        data["-1_1"] = "text: 算法社区;";

        <%  
		ArrayList list = (ArrayList)(request.getAttribute("problemMenuList"));
		
		//构造树，注意需要有个根节点（所谓根节点指的是其父节点部分的ID为 0		
		Problem entity = null;
		
		for (int i = 0; i < list.size(); i++){
		    entity = (Problem)list.get(i);
			StringBuffer str = new StringBuffer("");
			str.append("data['");
			str.append(entity.getType());//构造nodes标志的父节点部分
			str.append("_");
			str.append(entity.getSubType());//构造nodes标志的自身节点部分
			str.append("']").append( " = 'text:");
			str.append(entity.getName()+";");//树上显示的名称
			str.append("url:");
			str.append("../algorithm/algorithm!list.action?problemId=" + entity.getId());//点击节点后对应的 URL
			str.append("\';");
			
			out.println(str.toString());	
			
		  };        
	  %>  
        //*
        Using("System.Web.UI.WebControls.MzTreeView");
        var a = new MzTreeView();
        a.dataSource = data
        //a.rootId="1";
        a.autoSort=false;
        a.useCheckbox=false;
        a.canOperate=true;
        document.write(a.render());
        a.expandLevel(1);
        //*/

        </SCRIPT>
        </TD></TR></TBODY></TABLE>
        
</DIV>   </TD></TR></TBODY></TABLE>
<SCRIPT language=javascript type=text/javascript>
var isGuest = true;
var username = "guest";
var apiUrl = "/Common/Notification.ashx?callback=callback";
var delay = 20 * 60 * 1000;
var timer = 0;
var $NotifyInfo$ = {
    count: -1,
    url1: "http://hi.csdn.net/space-notice.html", 
    url3: "http://hi.csdn.net/space-notice.html"
};
var $MessageInfo$ = {
    count: -1,
    url1: "http://hi.csdn.net/space-pm.html", 
    url3: "http://hi.csdn.net/space-pm.html" 
};
var $FriendInfo$ = {
    count: -1,
    url1: "http://hi.csdn.net/cp.php?ac=friend&op=request", 
    url3: "http://hi.csdn.net/space-friend.html" 
};

function callback(result) {
	if (!result.succ) return;
	if (result.message && result.message.unread)
		$MessageInfo$.count = result.message.unread;
	else $MessageInfo$.count = 0;
	if (result.notification && result.notification.unread)
		$NotifyInfo$.count = result.notification.unread;
	else $NotifyInfo$.count = 0;
	if (result.friendRequest && result.friendRequest.unread)
		$FriendInfo$.count = result.friendRequest.unread;
	else $FriendInfo$.count = 0;
	
	DoFriend();
	DoMessage();
	DoNotify();
	DoTitle();
}

var anchors = document.getElementsByTagName("a");
for (var i = 0; i < anchors.length; i++)
	if (anchors[i].getAttribute("src"))
		anchors[i].onclick = anchorclick;

var froum = document.getElementById("forum");
if (froum) {
    froum.style.display = "";
    froum.src = "ForumContent.aspx";
}

function BodyLoad(){
    ChangeUserState();
}

function anchorclick() {
    if (typeof LogClickCount == "function") LogClickCount(this, this.getAttribute("clickID"));
    var anchors = document.getElementsByTagName("a");
    for (var i = 0; i < anchors.length; i++)
        if (anchors[i].getAttribute("src") &&
            anchors[i].getAttribute("right") == "true")
        anchors[i].parentNode.className = "sideright";
    else anchors[i].parentNode.className = "";
    this.parentNode.className = "here";
    var frames = document.getElementsByTagName("iframe");
    for (var i = 0; i < frames.length; i++)
        frames[i].style.display = "none";

    var frame = document.getElementById(this.getAttribute("dest"));
    if (frame) {
        if (!frame.src) frame.src = this.getAttribute("src");
        frame.style.display = "";
    }
}

function $(id){return document.getElementById(id);}

function callScript(url, loaded, error){
    var script = document.createElement("script");
    script.type = "text/javascript";
    script.src = url; 
    script.onreadystatechange = function(){
        switch (this.readyState){
            case "complete":
            case "loaded":
                if (typeof loaded == "function") loaded();
                script.parentNode.removeChild(script);
                break;
        }
    }
    script.onload = function(){
        if (typeof loaded == "function") loaded();
        script.parentNode.removeChild(script);
    }
    script.onerror = function(){
        if (typeof error == "function") error();
    }
    document.body.parentNode.appendChild(script);
}

function setElementText(element, text){
    if (typeof element == "undefined") return;
    if (typeof element.textContent != "undefined")
        element.textContent = text;
    else (typeof element.innerText != "undefined")
        element.innerText = text;
}

function ChangeUserState() {
    $("a_helpCenter").style.display = isGuest ? "" : "none";
    $("a_userRule").style.display = isGuest ? "" : "none";
    $("a_login").style.display = isGuest ? "" : "none";
    $("a_register").style.display = isGuest ? "" : "none";
   

    $("a_postTopic").style.display = isGuest ? "none" : "";
    $("a_notify").style.display = isGuest ? "none" : "";
    $("a_postBlog").style.display = isGuest ? "none" : "";
    $("a_message").style.display = isGuest ? "none" : "";
    $("a_space").style.display = isGuest ? "none" : "";
    $("td_logonout").style.display = isGuest ? "none" : "";
    $("a_friend").style.display = isGuest ? "none" : "";
    
    setElementText($("h4_username"), username);
    var froum = document.getElementById("forum");
    if (froum && froum.contentWindow && froum.contentWindow.document) {
        var input_content = froum.contentWindow.document.getElementById("input_content");
        if (input_content &&
            typeof input_content.content != "undefined" && input_content.content)
        {
            input_content.content.setGuest(isGuest);
            input_content.content.onSelectedChange = ContentSelectedChange;
        }
    }
    clearInterval(timer);
    if (isGuest) {
        $NotifyInfo$.count = 0;
        $MessageInfo$.count = 0;
        $FriendInfo$.count = 0;
        $("img_picture").src = "<%=contextPath%>/images/algothrim/2_guest.gif";
    } else {
        callScript(apiUrl + "&_t=" + Math.random());
        timer = setInterval(function(){callScript(apiUrl + "&_t=" + Math.random());}, delay);
    }
}

function ContentSelectedChange(selectedNode) {
    var re = /^\w+$/ig;
    if (typeof selectedNode.alias == "string" && re.exec(selectedNode.alias)) {
        $("a_postTopic").href = "http://forum.csdn.net/PointForum/Forum/PostTopic.aspx?alias=" + selectedNode.alias;
    } else $("a_postTopic").href = "http://forum.csdn.net/PointForum/Forum/PostTopic.aspx"
}

function a_notify_click(sender) {
    if (typeof LogClickCount == "function") LogClickCount(sender, 52);
    ClearNotify();
}

function a_message_click(sender) {
    if (typeof LogClickCount == "function") LogClickCount(sender, 53);
    ClearMessage();
}

function a_friend_click(sender) {
    if (typeof LogClickCount == "function") LogClickCount(sender, 54);
    ClearFriend();
}

function td_logonout_click(sender) {
    (new Image).src = sender.href + "?_t_=" + (new Date).getTime().toString(36);
    if (typeof LogClickCount == "function") LogClickCount(sender, 55);
    isGuest = true;
    setTimeout("ChangeUserState();", 500);
    username = "guest";
}
//JScript 文件
function LogClickCount(link,areaId)
{
    var url=window.location.href;
    var myImage=new Image(0,0);
    if(link!=null && link!='')
    {
        myImage.src="http://counter.csdn.net/a/Counter.aspx?area=" + areaId+"&u="+ escape(link);
    }
    else
    {
        myImage.src="http://counter.csdn.net/a/Counter.aspx?area=" + areaId+"&u="+ escape(link);
    }
}
</SCRIPT>      
</body>
</html>